<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>拉拉货物流有限公司</title>
		<meta name="keywords" content="拉拉货物流有限公司,汕头物流配送,汕头物流,汕头物流货运,汕头货运,全国货运,厦门物流配送,深圳物流配送,广州物流配送,物流配送,物流货运,货运配送" />
	    <meta name="description" content="拉拉货物流有限公司是一家承接全国各地门到门配送业务的专业第三方物流，为企业量身定做仓储、配送物流方案，针对大小客户配备专业项目小组进行专人专车对接。" />
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	    <link rel="stylesheet" href="css/amazeui.min.css" type="text/css" />
	    <link rel="stylesheet" href="css/style.css" type="text/css" />
	    <script type="text/javascript" src="js/jquery.min.js" ></script>
	    <script type="text/javascript" src="js/amazeui.min.js" ></script>
	</head>
	<body class=" bgcolor">
		<header data-am-widget="header" class="am-header am-header-default header-green1">
	      <div class="am-header-left am-header-nav ">
		        <a href="javascript:history.back()" style="color: #fff;"><i class="am-icon-chevron-left"></i></a>
	        </div>
		  <h1 class="am-header-title" style="color: #fff;">添加银行卡</h1>
       </header>
       <div class="jl"></div>
	   <form >
	   	
	  
       <div class="addcard">
       	  <div class="addcard-kh">
       	  	<span >卡号</span>	
       	    <input type="text" name="card" id="kahao" placeholder="请以62217/62218/62219开头" />
       	  </div>
		  <input type="text" name="type" style="display: none;"  />
		   <input type="text" name="userId" style="display: none;"  />
		   
		   <ul class="bank">
		  <li style="display: none;" id="zhongguo">
		  	<img src="images/zgyh.png" />
		  	<div class="bankname">
		  		<p class="name">中国银行</p>
		  	</div>
		  </li>
		  
		  <li style="display: none;" id="jiaotong">
		  	<img src="images/jtyh.png" />
		  	<div class="bankname">
		  		<p class="name">交通银行</p>
		  	</div>
		  </li>
		  
		  <li style="display: none;" id="gongshang">
		  	<img src="images/gsyh.png" />
		  	<div class="bankname">
		  		<p class="name">工商银行</p>
		  	</div>
		  </li>
		  
		  </ul>
       	  <div class="addcard-kh" style="border-radius: 5px 5px 0 0;">
       	  	<span>姓名</span>
       	    <input type="text" name="name" placeholder="请填写真实姓名"/>
       	  </div>
       	  <div class="addcard-kh" style=" margin-top: -1.1rem; border-radius: 0 0 5px 5px;">
       	  	<span>身份证</span>
       	    <input type="text" name="idNumber" placeholder="请填写身份证号"/>
       	  </div>
       	  <div class="addcard-kh">
       	  	<span>手机号</span>
       	    <input type="text" name="phone" placeholder="请填写银行预留手机号"/>
       	  </div>
       </div>
       <div class="agree">
	    	<input type="checkbox" name="checkbox" value="同意" checked="">&nbsp;同意
		    <a href="" class="reg1">《货拉拉物流用户协议》</a>
	    </div>
	    <button class="save" type="button">添加</button>
		 </form>
	</body>
	<script type="text/javascript">
		var url=JSON.parse(sessionStorage.getItem("url"))
		var user=JSON.parse(sessionStorage.getItem("user"))
		$("input[name=userId]").val(user.id)
		$("#kahao").blur(function(){
			var kaka=$("#kahao").val().substring(0,5);
				console.log(kaka)
				if(kaka=='62217'){
					$("#zhongguo").css("display",'block')
					$("input[name=type]").val('1')
				}
				if(kaka=='62218'){
					$("#jiaotong").css("display",'block')
					$("input[name=type]").val('2')
				}
				if(kaka=='62219'){
					$("#gongshang").css("display",'block')
					$("input[name=type]").val('3')
				}
			
			
			
		})
		
		
		$(".save").click(function(){
			if($(":checked").length==0){
				alert("请勾选用户协议")
			}
			$.ajax({
				url:url+'/bank/save',
				dataType:'json',//服务器返回json格式数据
				type:'post',//HTTP请求类型
				data:$("form").serialize(),
				timeout:10000,//超时时间设置为10秒；
				success:function(r){
					if(r.code==200)
					console.log(r.data)
					location.href='bankcard.html'
					
				},
				error:function(xhr,type,errorThrown){
					
				}
			});
			
			
			
		})
	
	</script>
	
	
	
</html>
